import type { TableColumnsType } from 'antd';
import React, { useEffect, useState } from 'react';
import { ColumnsType } from 'antd/es/table';
import {
  Popconfirm,
  Space,
  Table,
  Col,
  Input,
  Card,
  Collapse,
  Form,
  Layout,
  Select,
  Button,
  Descriptions,
  Spin,
  Badge,
} from 'antd';
import { connect } from 'umi';
import { color } from 'echarts';

const { Panel } = Collapse;
/*
表格数据
 */
interface ScoreTwoDetailCounsellerType {
  dimensionOne: {
    idealsBeliefs: number; //理想信念
    practicalService: number; //实践服务
    literatureArt: number; //文化艺术
    academicTechnology: number; //学术科技
    socialWork: number; //社会工作
    physicalFitness: number; //体育素质
  };
  dimensionTwo: {
    activitiesCompetitions: number; //活动竞赛
    awardsHonors: number; //评奖评优
    studentOrganization: number; //学生组织
  };
  dimensionThree: {
    collegeLevel: number; //院级
    universityLevel: number; //校级
    provincialLevel: number; //省级
    nationalLevel: number; //国家级
  };
  totalGrade: number; //
}
interface StudentScoreTwoDetialCounsellerType {
  studentCode: string; //学号
  studentName: string; //姓名
  sex: string; //性别
  enrollment: string; //入学年月
  programme: number; //学制
  mentorName: string; //班导师
  classRank: number; //班级排名
  majorRank: number; //专业排名
  overallGrade: number; //总成绩
  // firstYear: ScoreTwoDetailCounsellerType;//第一年数据
  // secondYear: ScoreTwoDetailCounsellerType;//第一年数据
  // thirdYear: ScoreTwoDetailCounsellerType;//第一年数据
  // forthYear: ScoreTwoDetailCounsellerType;//第一年数据
  dimensionOne: {
    idealsBeliefs: number; //理想信念
    practicalService: number; //实践服务
    literatureArt: number; //文化艺术
    academicTechnology: number; //学术科技
    socialWork: number; //社会工作
    physicalFitness: number; //体育素质
  };
  dimensionTwo: {
    activitiesCompetitions: number; //活动竞赛
    awardsHonors: number; //评奖评优
    studentOrganization: number; //学生组织
  };
  dimensionThree: {
    collegeLevel: number; //院级
    universityLevel: number; //校级
    provincialLevel: number; //省级
    nationalLevel: number; //国家级
  };
  totalGrade: number; //
}

const StudentTableList = (props: any) => {
  //定义数据
  const { Content } = Layout;
  const [data, setData] = useState<StudentScoreTwoDetialCounsellerType>();

  /*
  异步操作
  ----------------------------------------------------------------------------------------------------------------------
   */
  const setDataDetial = () => {
    let message = {
      code: 200,
      msg: '查找成功！',
      data: {
        studentCode: '194765',
        studentName: '余霖辉',
        sex: '男',
        enrollment: '201909',
        programme: 4,
        mentorName: '李华',
        overallGrade: 31.11,
        classRank: 1,
        majorRank: 6,
        firstYear: {
          dimensionOne: {
            idealsBeliefs: 7.9,
            practicalService: 7.0,
            literatureArt: 0.0,
            academicTechnology: 9.18,
            socialWork: 1.1,
            physicalFitness: 1.4,
          },
          dimensionTwo: {
            activitiesCompetitions: 26.13,
            awardsHonors: 6.48,
            studentOrganization: 3.0,
          },
          dimensionThree: {
            collegeLevel: 9.05,
            universityLevel: 12.16,
            provincialLevel: 4.4,
            nationalLevel: 4.0,
          },
          totalGrade: 87.3,
        },
        secondYear: {
          dimensionOne: {
            idealsBeliefs: 7.9,
            practicalService: 7.0,
            literatureArt: 0.0,
            academicTechnology: 9.18,
            socialWork: 1.1,
            physicalFitness: 1.4,
          },
          dimensionTwo: {
            activitiesCompetitions: 26.13,
            awardsHonors: 6.48,
            studentOrganization: 3.0,
          },
          dimensionThree: {
            collegeLevel: 9.05,
            universityLevel: 12.16,
            provincialLevel: 4.4,
            nationalLevel: 4.0,
          },
          totalGrade: 87.3,
        },
        thirdYear: {
          dimensionOne: {
            idealsBeliefs: 7.9,
            practicalService: 7.0,
            literatureArt: 0.0,
            academicTechnology: 9.18,
            socialWork: 1.1,
            physicalFitness: 1.4,
          },
          dimensionTwo: {
            activitiesCompetitions: 26.13,
            awardsHonors: 6.48,
            studentOrganization: 3.0,
          },
          dimensionThree: {
            collegeLevel: 9.05,
            universityLevel: 12.16,
            provincialLevel: 4.4,
            nationalLevel: 4.0,
          },
          totalGrade: 87.3,
        },
        forthYear: {
          dimensionOne: {
            idealsBeliefs: 7.9,
            practicalService: 7.0,
            literatureArt: 0.0,
            academicTechnology: 9.18,
            socialWork: 1.1,
            physicalFitness: 1.4,
          },
          dimensionTwo: {
            activitiesCompetitions: 26.13,
            awardsHonors: 6.48,
            studentOrganization: 3.0,
          },
          dimensionThree: {
            collegeLevel: 9.05,
            universityLevel: 12.16,
            provincialLevel: 4.4,
            nationalLevel: 4.0,
          },
          totalGrade: 87.3,
        },
      },
    };
    setData(message.data);
  };
  const getDetialData = (value: any) => {
    console.log(value);
    const { dispatch } = props;
    if (dispatch) {
      dispatch({
        type: 'StudentAnalysisHuang/getStudentClassTwoBystudentCode',
        payload: {
          ...value,
          callback: (value: any) => {
            console.log(value);
            setData(value);
          },
        },
      });
    }
  };
  useEffect(() => {
    if (props.StudentAnalysisHuang.studentDetialList.length !== 0) {
      setData(props.StudentAnalysisHuang.studentDetialList);
    }
  }, [props]);
  return (
    <Layout style={{ backgroundColor: 'white', width: '100%' }}>
      {/* <button onClick={setDataDetials("194765")}></button> */}
      <div>
        <Card style={{ marginBottom: 30 }}>
          <Descriptions title="学生基本信息" bordered>
            <Descriptions.Item label="学号（Number）">
              {data?.studentCode}
            </Descriptions.Item>
            <Descriptions.Item label="姓名（Name）">
              {data?.studentName}
            </Descriptions.Item>
            <Descriptions.Item label="性别（Gender）">
              {data?.sex}
            </Descriptions.Item>
            <Descriptions.Item label="入学年份（Year）">
              {data?.enrollment}
            </Descriptions.Item>
            <Descriptions.Item label="学制（LengthOfSchool）">
              {data?.programme}
            </Descriptions.Item>
            <Descriptions.Item label="班导师（ClassTeacher）">
              {data?.mentorName}
            </Descriptions.Item>
            <Descriptions.Item label="班级排名（Class rank）">
              <Badge status="processing" text={data?.classRank} />
            </Descriptions.Item>
            <Descriptions.Item label="专业排名（Major rank）">
              <Badge status="processing" text={data?.majorRank} />
            </Descriptions.Item>
            <Descriptions.Item label="总成绩（Score）">
              <Badge status="processing" text={data?.overallGrade} />
            </Descriptions.Item>
          </Descriptions>
        </Card>
        <Card style={{ marginBottom: 30 }}>
          <Col>
            <Collapse>
              <Panel header={'第一学年'}>
                <Descriptions title="第一学年" bordered>
                  <Descriptions.Item
                    label="第一维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="理想信念">
                    {data?.dimensionOne?.idealsBeliefs}
                  </Descriptions.Item>
                  <Descriptions.Item label="社会工作">
                    {data?.dimensionOne?.socialWork}
                  </Descriptions.Item>
                  <Descriptions.Item label="学术科技">
                    {data?.dimensionOne?.academicTechnology}
                  </Descriptions.Item>
                  <Descriptions.Item label="文化艺术">
                    {data?.dimensionOne?.literatureArt}
                  </Descriptions.Item>
                  <Descriptions.Item label="实践服务">
                    {data?.dimensionOne?.practicalService}
                  </Descriptions.Item>
                  <Descriptions.Item label="体育素质">
                    {data?.dimensionOne?.physicalFitness}
                  </Descriptions.Item>
                  <Descriptions.Item
                    label="第二维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="活动竞赛">
                    {data?.dimensionTwo?.activitiesCompetitions}
                  </Descriptions.Item>
                  <Descriptions.Item label="评奖评优">
                    {data?.dimensionTwo?.awardsHonors}
                  </Descriptions.Item>
                  <Descriptions.Item label="学生组织">
                    {data?.dimensionTwo?.studentOrganization}
                  </Descriptions.Item>
                  <Descriptions.Item
                    label="第三维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="国家级">
                    {data?.dimensionThree?.nationalLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="省级">
                    {data?.dimensionThree?.provincialLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="校级">
                    {data?.dimensionThree?.universityLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="院级">
                    {data?.dimensionThree?.collegeLevel}
                  </Descriptions.Item>
                </Descriptions>
              </Panel>
            </Collapse>
          </Col>
          <Col>
            <Collapse>
              <Panel header={'第二学年'}>
                <Descriptions title="第二学年" bordered>
                  <Descriptions.Item
                    label="第一维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="理想信念">
                    {data?.dimensionOne?.idealsBeliefs}
                  </Descriptions.Item>
                  <Descriptions.Item label="社会工作">
                    {data?.dimensionOne?.socialWork}
                  </Descriptions.Item>
                  <Descriptions.Item label="学术科技">
                    {data?.dimensionOne?.academicTechnology}
                  </Descriptions.Item>
                  <Descriptions.Item label="文化艺术">
                    {data?.dimensionOne?.literatureArt}
                  </Descriptions.Item>
                  <Descriptions.Item label="实践服务">
                    {data?.dimensionOne?.practicalService}
                  </Descriptions.Item>
                  <Descriptions.Item label="体育素质">
                    {data?.dimensionOne?.physicalFitness}
                  </Descriptions.Item>
                  <Descriptions.Item
                    label="第二维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="活动竞赛">
                    {data?.dimensionTwo?.activitiesCompetitions}
                  </Descriptions.Item>
                  <Descriptions.Item label="评奖评优">
                    {data?.dimensionTwo?.awardsHonors}
                  </Descriptions.Item>
                  <Descriptions.Item label="学生组织">
                    {data?.dimensionTwo?.studentOrganization}
                  </Descriptions.Item>
                  <Descriptions.Item
                    label="第三维度"
                    span={3}
                  ></Descriptions.Item>
                  <Descriptions.Item label="国家级">
                    {data?.dimensionThree?.nationalLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="省级">
                    {data?.dimensionThree?.provincialLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="校级">
                    {data?.dimensionThree?.universityLevel}
                  </Descriptions.Item>
                  <Descriptions.Item label="院级">
                    {data?.dimensionThree?.collegeLevel}
                  </Descriptions.Item>
                </Descriptions>
              </Panel>
            </Collapse>
          </Col>
        </Card>
      </div>
    </Layout>
  );
};

export default connect(({ StudentAnalysisHuang }: any) => ({
  StudentAnalysisHuang,
}))(StudentTableList);
